package com.uwlaser.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import com.uwlaser.base.CommonModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
* @author huangpan
* @date 2022-12-02
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("factory_shift")
public class FactoryShift extends CommonModel<FactoryShift> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "ID")
    @TableId(type= IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "班组ID")
    @NotNull
    private Integer teamGroupId;

    @ApiModelProperty(value = "班次编码")
    @NotBlank
    private String shiftCode;

    @ApiModelProperty(value = "班次名称")
    @NotBlank
    private String shiftName;

    @ApiModelProperty(value = "开始时间")
    @NotNull
    private String startTime;

    @ApiModelProperty(value = "结束时间")
    private String endTime;

    @ApiModelProperty(value = "是否禁用 0：否，1：是")
    @NotBlank
    private String isDisable;

    @ApiModelProperty(value = "备注说明")
    @NotBlank
    private String remark;

    @ApiModelProperty(value = "创建人")
    @TableField(fill= FieldFill.INSERT)
    private String createBy;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "更新人")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String updateBy;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "所属模型")
    private String templateCode;

    @ApiModelProperty(value = "是否跨天0：否，1：是")
    private String isAcross;

    @ApiModelProperty(value = "生产节拍")
    @NotBlank
    private String meter;

    @ApiModelProperty(value = "计划产量")
    @NotBlank
    private String yield;

    public void copyFrom(FactoryShift source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
